package cn.calm.swing.osgi.edit;

import java.util.Hashtable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import cn.calm.swing.osgi.api.MenuService;
import cn.calm.swing.osgi.edit.service.EditMenuService;

public class Activator implements BundleActivator{
	private ServiceRegistration<MenuService> registerService;
	@Override
	public void start(BundleContext context) throws Exception {
		Hashtable<String,String> para=new Hashtable<String, String>();
		para.put(MenuService.MENU_TREE, "edit");
		registerService = context.registerService(MenuService.class, new EditMenuService(), para);
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		if(registerService!=null){
			registerService.unregister();
		}
	}
}
